 

package com.zdkj.subway.st.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdkj.common.core.util.R;
import com.zdkj.common.log.annotation.SysLog;
import com.zdkj.subway.st.entity.SwTkTicketDeliveryDetail;
import com.zdkj.subway.st.service.SwTkTicketDeliveryDetailService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 车票配送/配入明细表
 *
 * @author cuilei
 * @date 2020-06-12 17:40:29
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swtkticketdeliverydetail" )
@Api(value = "swtkticketdeliverydetail", tags = "车票配送/配入明细表管理")
public class SwTkTicketDeliveryDetailController {

    private final  SwTkTicketDeliveryDetailService swTkTicketDeliveryDetailService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param swTkTicketDeliveryDetail 车票配送/配入明细表
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwTkTicketDeliveryDetailPage(Page page, SwTkTicketDeliveryDetail swTkTicketDeliveryDetail) {
        return R.ok(swTkTicketDeliveryDetailService.page(page, Wrappers.query(swTkTicketDeliveryDetail)));
    }


    /**
     * 通过id查询车票配送/配入明细表
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(swTkTicketDeliveryDetailService.getById(id));
    }

    /**
     * 新增车票配送/配入明细表
     * @param swTkTicketDeliveryDetail 车票配送/配入明细表
     * @return R
     */
    @ApiOperation(value = "新增车票配送/配入明细表", notes = "新增车票配送/配入明细表")
    @SysLog("新增车票配送/配入明细表" )
    @PostMapping
    public R save(@RequestBody SwTkTicketDeliveryDetail swTkTicketDeliveryDetail) {
        return R.ok(swTkTicketDeliveryDetailService.save(swTkTicketDeliveryDetail));
    }

    /**
     * 修改车票配送/配入明细表
     * @param swTkTicketDeliveryDetail 车票配送/配入明细表
     * @return R
     */
    @ApiOperation(value = "修改车票配送/配入明细表", notes = "修改车票配送/配入明细表")
    @SysLog("修改车票配送/配入明细表" )
    @PutMapping
    public R updateById(@RequestBody SwTkTicketDeliveryDetail swTkTicketDeliveryDetail) {
        return R.ok(swTkTicketDeliveryDetailService.updateById(swTkTicketDeliveryDetail));
    }

    /**
     * 通过id删除车票配送/配入明细表
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除车票配送/配入明细表", notes = "通过id删除车票配送/配入明细表")
    @SysLog("通过id删除车票配送/配入明细表" )
    @DeleteMapping("/{id}" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(swTkTicketDeliveryDetailService.removeById(id));
    }

}
